def dfs(lst,ans,path,i,n):
    if len(path)==n:
        ans.append(''.join(path))
        return 
    for k in lst[i]:
        path.append(k)
        dfs(lst,ans,path,i+1,n)
        path.pop()

def solve(digits):
    lst=[]
    for i in digits:
        i=int(i)
        if i==1: continue
        elif i<=6: lst.append(''.join([chr(ord('a')+3*(i-2)+j) for j in range(3)]))
        if i==7: lst.append('pqrs')
        if i==8: lst.append('tuv')
        if i==9: lst.append('wxyz')
    n=len(lst)
    print(lst)
    ans=[]
    dfs(lst,ans,[],0,n)
    return ans 

digits="23"
print(solve(digits))
digits=""
print(solve(digits))
digits="2"
print(solve(digits))
    